package com.wnd.dell.myapplication;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.viewpagerindicator.IconPagerAdapter;

import java.util.ArrayList;
import java.util.List;


public class PageAdapter extends PagerAdapter {


    private List<View> viewList;
    private List<Integer> drawableList =new ArrayList<>();
    private String[] titles = {"第1页", "第2页", "第3页", "第4页",};
    public PageAdapter(List<View> list) {
        this.viewList =list;
        drawableList.add(R.mipmap.ic_launcher);
        drawableList.add(R.mipmap.ic_launcher_round);
        drawableList.add(R.mipmap.ic_launcher);
        drawableList.add(R.mipmap.ic_launcher_round);
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        // TODO Auto-generated method stub
        return arg0 == arg1;
    }


    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return viewList.size();
    }

    @Override
    public void destroyItem(ViewGroup container, int position,
                            Object object) {
        // TODO Auto-generated method stub
        container.removeView(viewList.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        // TODO Auto-generated method stub
        container.addView(viewList.get(position));


        return viewList.get(position);
    }
}
